package com.yj.provider.exception;

import com.yj.provider.response.ResultResponse;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyExHandler {

    @ExceptionHandler(value = {BusinessException.class})
    public ResultResponse handler(BusinessException exception){


        return ResultResponse.failure().data("error",exception.getMessage());
    }

    @ExceptionHandler(value = BusException.class)
    public ResultResponse  handler2(BusException e){

        return ResultResponse.failure(new BusException(ExceEnum.SYSTEM_ERROR));
    }

}
